package com.kingsoft.dc.khaos.extender.auth.utils;

import com.kingsoft.dc.khaos.extender.model.AuthContants;
import com.kingsoft.dc.khaos.extender.model.ParamConfig;

import java.util.Map;

/**
 * Created by jing on 19/8/10.
 */
public class ConfigUtils {

    public static ParamConfig loadParamConfigFromEnv() {
        Map<String, String> envMap = System.getenv();
        ParamConfig config = new ParamConfig();
        config.setRunEnv(envMap.get(AuthContants.RUN_ENV));
        config.setDsId(Integer.parseInt(envMap.get(AuthContants.DS_ID)));
        config.setAuthUrl(envMap.get(AuthContants.SERVER_AUTH_URL));
        config.setUrl(envMap.get(AuthContants.SERVER_URL));
        config.setJobProjectId(Integer.parseInt(envMap.get(AuthContants.PROJECT_ID)));
        return config;
    }

}

